import jwt

secret = "123456"
algorithm = "HS256"

token = jwt.encode({"name":"lisi"}, secret, algorithm=algorithm)
print(token) # b'eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJuYW1lIjoibGlzaSJ9.EhqffOP57eClcTL5N9PjvY7RBNRTyU5iAJV-WqGXe1Y'
print(token.decode()) # eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJuYW1lIjoibGlzaSJ9.EhqffOP57eClcTL5N9PjvY7RBNRTyU5iAJV-WqGXe1Y

info = jwt.decode(token, '123456', algorithms=[algorithm])
print(info) #{'name': 'lisi'}



